package com.project.bean;

import com.project.Util.ValidateAdd;
import com.project.Util.ValidateUpdate;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

/**
 * @author lyl
 * description:
 */
public class UserManBean {
    private int id;
    @NotBlank(groups = ValidateAdd.class, message = "姓名不能为空")
    private String name;
    @Length(groups = ValidateAdd.class, min = 6, max = 6, message = "密码只能是六位字符")
    private String pwd;
    @Pattern(groups = {ValidateAdd.class, ValidateUpdate.class}, regexp = "1[3578]\\d{9}", message = "电话格式不正确")
    private String phone;
    @Min(groups = {ValidateAdd.class, ValidateUpdate.class},
            value = 1800, message = "这么低的工资，不让人活了")
    @Max(groups = {ValidateAdd.class, ValidateUpdate.class},
            value = 10000, message = "工资这么高，老板扔钱也不是这么扔的")
    @NotBlank(groups = {ValidateAdd.class, ValidateUpdate.class},
            message = "想让唐宇成拉车，还不给吃草，有这样的好事？")
    private Integer money;
    @Email(groups = ValidateAdd.class, message = "邮箱格式错误")
    private String email;


    public UserManBean(int id, String name, String pwd, String phone, int money) {
        this.id = id;
        this.name = name;
        this.pwd = pwd;
        this.phone = phone;
        this.money = money;
    }

    public UserManBean() {
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "UserManBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", pwd='" + pwd + '\'' +
                ", phone='" + phone + '\'' +
                ", money=" + money +
                ", email='" + email + '\'' +
                '}' + "\n";
    }

}
